import Vue from 'vue'
import Router from 'vue-router'


const layout = () =>
    import ('../pages/layout.vue')
<<<<<<< HEAD
const index = () =>
    import ('../pages/index.vue')
=======
<<<<<<< HEAD
const index = () =>
    import ('../pages/index.vue')
=======
>>>>>>> d519b3a9147c56fc3b4298a9549da21438cdf484
>>>>>>> bab7c7a15a7723f417b1c3b2179ae51ae1f154c9
const menu = () =>
    import ('../pages/menu')
const menuInfo = () =>
    import ('../pages/menu/info.vue')
const role = () =>
    import ('../pages/role')
<<<<<<< HEAD
const category = () =>
    import ('../pages/category')
=======
>>>>>>> bab7c7a15a7723f417b1c3b2179ae51ae1f154c9
    // const roleInfo = () =>
    //     import ('../pages/role/info.vue')
const admin = () =>
    import ('../pages/admin')
const login = () =>
    import ('../pages/login')


Vue.use(Router)

// 解决:NavigationDuplicated: Avoided redundant navigation to current location.捕获错误
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
    mode: 'history',
    routes: [{
            path: '/',
            name: 'layout',
            component: layout,
            children: [
<<<<<<< HEAD
                // 首页
                { path: '', component: index },
                // 菜单列表
=======
<<<<<<< HEAD
                // 首页
                { path: '', component: index },
                // 菜单列表
=======
>>>>>>> d519b3a9147c56fc3b4298a9549da21438cdf484
>>>>>>> bab7c7a15a7723f417b1c3b2179ae51ae1f154c9
                { path: 'menu', component: menu },
                // 添加菜单
                { path: 'menu/add', component: menuInfo },
                // 修改菜单
                { path: 'menu/:id', component: menuInfo },
<<<<<<< HEAD
                // 角色管理
                { path: 'role', component: role },
                // 商品分类
                { path: 'category', component: category },
=======
                { path: 'role', component: role },
>>>>>>> bab7c7a15a7723f417b1c3b2179ae51ae1f154c9
                // { path: 'role/add', component: roleInfo },
                { path: 'admin', component: admin },
            ]
        },
        {
            path: '/login',
            component: login
        }
    ]
})